package gov.pbc.nn.core.datasource;

import com.alibaba.druid.proxy.jdbc.PreparedStatementProxy;
import com.alibaba.druid.proxy.jdbc.StatementProxy;

public class Log4jFilter extends com.alibaba.druid.filter.logging.Log4jFilter {

	@Override
	protected void statementExecuteBatchBefore(StatementProxy statement) {
		super.statementExecuteBatchBefore(statement);
		if (statement instanceof PreparedStatementProxy) {
			logParameter((PreparedStatementProxy) statement);
		}
	}

	@Override
	protected void statementExecuteQueryBefore(StatementProxy statement,
			String sql) {
		statement.setLastExecuteStartNano();
		if (this.isStatementExecuteQueryAfterLogEnabled()) {
			if (statement instanceof PreparedStatementProxy) {
				logParameter((PreparedStatementProxy) statement);
			}
		}
	}
}
